const ContractService = require('../services/contracts');
module.exports = app => {
  // 查
  app.post(`${process.env.VUE_APP_BASE_API}/contract/list`, async (req, res) => {
    const { body } = req;
    const { limit = 10, offset = 0, flowName= '' } = body;
    const contractService = new ContractService();
    const contracts = await contractService.searchWithFilter({
      limit,
      offset,
      flowName
    });
    const count = await contractService.countWithFilter({flowName});

    return res.json({
      code: 20000,
      data: { contracts, totalCount: count },
    });
 
  });

};
